﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chowpoo.Sql;
using CourseSystem.Core.Entities;
using CourseSystem.Core.SqlServerDAL;

namespace CourseSystem.Core.BLL
{
    public class CommonStudyBLL : CommonBLL<CommonStudyInfo, CommonStudyDAL>
    {

        public static IQueryable<CommonStudyInfo> GetList(int type)
        {
            var re = GetList().Where(o => o.Type == type);
            return re;
        }

        public static CommonStudyInfo Get(int id)
        {
            using (var dal = new CommonStudyDAL(Settings.ConnectionName))
            {
                var re = dal.SelectSingle(o => o.Id == id);
                return re;
            }
        }

        public static bool Del(int id)
        {
            using (var dal = new CommonStudyDAL(Settings.ConnectionName))
            {
                return dal.Delete(o => o.Id == id) != null;
            }
        }

    }
}
